<?php

class Default_NoticiaController extends Zend_Controller_Action {

    private $_noticiaModelo;

    public function init()
    {
        $this->view->headLink(array('type' => 'image/x-icon', 'rel' => 'shortcut icon', 'href' => '/images/favicon.ico'), 'APPEND');
        $this->view->headLink()->appendStylesheet('/css/paginas.css');
        $this->view->headLink()->appendStylesheet('/css/forms.css');
        $this->view->headScript()->offsetSetFile(1, '/js/jquery-1.3.2.min.js');
        $this->view->headScript()->offsetSetFile(2, '/js/jquery.form.js');
        $this->view->headScript()->offsetSetFile(3, '/js/sitio.js');

        $this->_noticiaModelo = new admin_Model_NoticiaMapper();
    }

    public function indexAction() {

        $this->view->titulo = 'Noticias';
        $this->view->noticias = $this->_noticiaModelo->obtenerTodos();
        
    }

    public function verAction() {

        $slug = $this->_request->getParam('slug', 0);
        $noticia = $this->_noticiaModelo->obtenerPorSlug($slug);

        $this->view->titulo = 'Noticias | ' .$noticia->titulo;
        $this->view->noticia = $noticia;
        
    }

}